package com.example.test.advice.第二章_基本类型.建议27_谨慎包装类型的大小比较;

public class Client {

    public static void main(String[] args) {
        Integer i = new Integer(100);
        Integer j = new Integer(10);
        compare(i,j);
        System.out.println("==========");
        compare2(i,j);
    }

    public static void compare(Integer i,Integer j){
        System.out.println("i==j:"+(i==j));
        System.out.println("i<j:"+(i<j));
        System.out.println("i>j:"+(i>j));
    }

    public static void compare2(Integer i,Integer j){
        int r = i.compareTo(j);
        switch (r){
            case 0:
                System.out.println("i == j");
                break;
            case 1:
                System.out.println("i>j");
                break;
            case -1:
                System.out.println("i<j");
                break;
            default:
                System.out.println("没有匹配项");
        }
    }

}
